const regentatorRuntime = require('../utils/regenerator-runtime/index')
var base_url = 'http://localhost:8079';
var base_uri = 'base/device'
export default {
  getDeviceList() {
    return new Promise((resolve, reject) => {
      let url = `${base_url}/${base_uri}/getDeviceList`
      wx.request({
        url: url,
        method: 'GET',
        header: {
          "content-type": "application/x-www-form-urlencoded"
        },
        success: res => {
            resolve(res)
        }
      })
    })
  },
  deleteDeviceByDeviceId(deviceId) {
    wx.request({
      url: `${base_url}/${base_uri}/deleteById/${deviceId}`,
      method: "GET",
      success(res) {
        console.log(res.data);
      }
    })
  },
  getDeviceByDeviceId(deviceId) {
    wx.request({
      url: `${base_url}/${base_uri}/getDeviceByDeviceId/${deviceId}`,
      method: "GET",
      success(res) {
        console.log(res.data);
      }
    })
  },
  setDeviceStatus(deviceId, status) {
    wx.request({
      url: `${base_url}/${base_uri}/setDeviceStatus/${deviceId}/${status}`,
      method: "POST",
      success(res) {
        console.log(res.data);
      }
    })
  }
}